/**
 * Description:
 * Class Name:AccessExceptionMsg
 * Date:2022/3/26 11:17
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第10章_异常处理._10_2_异常处理机制._10_2_4_访问异常信息;

import java.io.FileInputStream;
import java.io.IOException;

public class AccessExceptionMsg {
    public static void main(String[] args) {
        try {
            var fis = new FileInputStream("a.txt");
        }
        catch (IOException ioException){
            System.out.println(ioException.getMessage());
            System.out.println("---------");
            ioException.printStackTrace();
        }
    }
}
//a.txt (系统找不到指定的文件。)
//---------
//java.io.FileNotFoundException: a.txt (系统找不到指定的文件。)
//at java.base/java.io.FileInputStream.open0(Native Method)
//at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
//at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
//at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111)
//at 疯狂Java讲义.第10章_异常处理._10_2_异常处理机制._10_2_4_访问异常信息.AccessExceptionMsg.main(AccessExceptionMsg.java:17)